
//router.js 编写规则  [[  地址 => 组件 => router-view ]]

import {createRouter,createWebHashHistory} from 'vue-router'
import def from '../components/default.vue';
import list from '../components/list.vue';
import add from '../components/add.vue';

let router = createRouter({
    history:  createWebHashHistory(),
    routes:[
        {
            path:"/", //默认页面
            redirect:"/list"
            //component: def
        },
        {
            path:"/xxxx", //默认页面
            redirect:"/list"
            //component: def
        },
        {
            path:"/list",
            //component: list
            components:{
                //list组件,在name=listView router-view标签展示
                listView:list
            }
        },
        {
            path:"/add",
            components:{
                addView: add
            }
        }
    ]
});

export default router;